package com.celesea.auth.grade.service;

import com.celesea.auth.grade.dao.GradeDao;
import com.celesea.auth.grade.entity.Grade;
import com.celesea.framework.entity.BusEntity;
import com.celesea.framework.service.AbstractBaseService;
import com.celesea.framework.util.EnvUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author JackYuan
 * @create 2017-10-26 23:17
 */
@Service
public class GradeServiceImpl extends AbstractBaseService<Grade> implements GradeService {

    @Autowired
    private GradeDao gradeDao;

    @Override
    public List<Grade> selectGrades() {
        Example example = new Example(Grade.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(BusEntity.TALENT_ID, EnvUtil.getTenantId());
        example.orderBy("sort").asc();
        return gradeDao.selectByExample(example);
    }
}
